package com.ruoyi.zxjd.work.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zxjd.work.domain.WorkTemplateTable6;
import com.ruoyi.zxjd.work.domain.bo.WorkProgressBO;
import com.ruoyi.zxjd.work.service.IWorkTemplateTable6Service;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 收到纪检监察干部问题线索办理情况Controller
 * 
 * @author lcc
 * @date 2021-03-01
 */
@Controller
@RequestMapping("/work/templatetable6")
public class WorkTemplateTable6Controller extends BaseController
{
    private String prefix = "work/templatetable6";

    @Autowired
    private IWorkTemplateTable6Service workTemplateTable6Service;

    @RequiresPermissions("work:templatetable6:view")
    @GetMapping()
    public String templatetable6()
    {
        return prefix + "/templatetable6";
    }

    /**
     * 查询收到纪检监察干部问题线索办理情况列表
     */
    @RequiresPermissions("work:templatetable6:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WorkTemplateTable6 workTemplateTable6)
    {
        startPage();
        List<WorkTemplateTable6> list = workTemplateTable6Service.selectWorkTemplateTable6List(workTemplateTable6);
        return getDataTable(list);
    }

    /**
     * 导出收到纪检监察干部问题线索办理情况列表
     */
    @RequiresPermissions("work:templatetable6:export")
    @Log(title = "收到纪检监察干部问题线索办理情况", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WorkTemplateTable6 workTemplateTable6)
    {
        List<WorkTemplateTable6> list = workTemplateTable6Service.selectWorkTemplateTable6List(workTemplateTable6);
        ExcelUtil<WorkTemplateTable6> util = new ExcelUtil<WorkTemplateTable6>(WorkTemplateTable6.class);
        return util.exportExcel(list, "templatetable6");
    }

    /**
     * 新增收到纪检监察干部问题线索办理情况
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存收到纪检监察干部问题线索办理情况
     */
    @RequiresPermissions("work:templatetable6:add")
    @Log(title = "收到纪检监察干部问题线索办理情况", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(WorkProgressBO workProgressBO)
    {
        return toAjax(workTemplateTable6Service.insertWorkTemplateTable6(workProgressBO));
    }

    /**
     * 修改收到纪检监察干部问题线索办理情况
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        WorkTemplateTable6 workTemplateTable6 = workTemplateTable6Service.selectWorkTemplateTable6ById(id);
        mmap.put("workTemplateTable6", workTemplateTable6);
        return prefix + "/edit";
    }

    /**
     * 修改保存收到纪检监察干部问题线索办理情况
     */
    @RequiresPermissions("work:templatetable6:edit")
    @Log(title = "收到纪检监察干部问题线索办理情况", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(WorkTemplateTable6 workTemplateTable6)
    {
        return toAjax(workTemplateTable6Service.updateWorkTemplateTable6(workTemplateTable6));
    }

    /**
     * 删除收到纪检监察干部问题线索办理情况
     */
    @RequiresPermissions("work:templatetable6:remove")
    @Log(title = "收到纪检监察干部问题线索办理情况", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(workTemplateTable6Service.deleteWorkTemplateTable6ByIds(ids));
    }
}
